package com.example.codereview;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;
import com.intellij.ui.content.ContentManager;

public class ReviewSidebarFrame implements ToolWindowFactory {

    private static ReviewView reviewView;

    public static ReviewView getReviewView(){
        return reviewView;
    }

    @Override
    public void createToolWindowContent(Project project, ToolWindow toolWindow) {
        final ContentFactory factory =  ContentFactory.SERVICE.getInstance();
        {
            ContentManager contentManager = toolWindow.getContentManager();

            GitView codeView = new GitView(project);
            Content codeContent = factory.createContent(codeView, "Code", false);
            contentManager.addContent(codeContent);

            ReviewSidebarFrame.reviewView = new ReviewView(project);
            Content reviewContent = factory.createContent(reviewView, "Review", false);
            contentManager.addContent(reviewContent);
        }
    }


}